package com.dinfo.common;

import java.util.Enumeration;
import java.util.Map;

import javax.servlet.http.HttpSession;

public class HttpSessionSidWrapper extends HttpSessionWrapper {

	private String sid = "";

	private Map map = null;

	public HttpSessionSidWrapper(String sid, HttpSession session) {
		super(session);
		this.sid = sid;
//		this.map = XSessionService.getInstance().getSession(sid);
	}

	public Object getAttribute(String arg0) {
		return this.map.get(arg0);
	}

	public Enumeration getAttributeNames() {
		return (new Enumerator(this.map.keySet(), true));
	}

	public void invalidate() {
		this.map.clear();
//		XSessionService.getInstance().removeSession(this.sid);
	}

	public void removeAttribute(String name) {
		this.map.remove(name);
		XSessionService.getInstance().removeAttribute(this.sid, name);
	}

	@SuppressWarnings("unchecked")
	public void setAttribute(String name, Object value) {
		this.map.put(name, value);
//		XSessionService.getInstance().saveSession(this.sid,name, value);
	}

}
